package com.douqu.game.core.entity;

import com.douqu.game.core.entity.common.CommonData;
import com.douqu.game.core.factory.ConstantFactory;
import com.douqu.game.core.factory.DataFactory;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author: Gavin.
 * Description: 十连抽
 * Date: 2017/8/18 0018 下午 3:47
 * Huan Yu Copyright (c) 2017 All Rights Reserved.
 */
public class LotteryObject extends GameObject {

    public int type;   //类型
    public int level;  //级别
    public int free;   //免费次数
    public int cd;     //cd时间单位（秒）
    public int rewardType; //奖励类型
    public RewardsObject[] rewards; //奖励对象数组
    public CommonData[] commonDatas; //资源消耗
    public int nextLevelCount; //到下一级的次数
    public int nextLevelPond;  //下一级奖池




    @Override
    public void setVariable(String key, String value)
    {
        try {
            if("rewards".equals(key))
            {
                String[] strs = value.split(ConstantFactory.DIVISION);
                rewards = new RewardsObject[strs.length];
                String[] temp = null;
                for(int i = 0; i < strs.length; i++)
                {
                    temp = strs[i].split(ConstantFactory.SEMICOLON);
                    rewards[i] = new RewardsObject(temp);
                }
            }
            else if("commonDatas".equals(key))
            {
                String[] strs = value.split(ConstantFactory.DIVISION);
                commonDatas = new CommonData[strs.length];
                for(int i = 0; i < strs.length; i++)
                {
                    commonDatas[i] = new CommonData(strs[i]);
                }
            }
            else
                super.setVariable(key, value);

        }catch (Exception e){
            System.out.println(e.getMessage());
        }
    }




    @Override
    public int getId() {
        return id;
    }

    @Override
    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public int getFree() {
        return free;
    }

    public void setFree(int free) {
        this.free = free;
    }

    public int getCd() {
        return cd;
    }

    public void setCd(int cd) {
        this.cd = cd;
    }

    public int getRewardType() {
        return rewardType;
    }

    public void setRewardType(int rewardType) {
        this.rewardType = rewardType;
    }

    public RewardsObject[] getRewards() {
        return rewards;
    }

    public void setRewards(RewardsObject[] rewards) {
        this.rewards = rewards;
    }

    public CommonData[] getCommonDatas() {
        return commonDatas;
    }

    public void setCommonDatas(CommonData[] commonDatas) {
        this.commonDatas = commonDatas;
    }

    public int getNextLevelCount() {
        return nextLevelCount;
    }

    public void setNextLevelCount(int nextLevelCount) {
        this.nextLevelCount = nextLevelCount;
    }

    public int getNextLevelPond() {
        return nextLevelPond;
    }

    public void setNextLevelPond(int nextLevelPond) {
        this.nextLevelPond = nextLevelPond;
    }
}
